#!/bin/sh

if [[ -z "$METIS_HOME" ]]; then
        echo "The METIS_HOME environment variable has not been set."
        echo "This is the directory where metis.sh and metis.config are stored"
        exit 1
fi

source "$METIS_HOME"metis-plugin.config

function test(){
	tool=$1
	jar=.jar$
	if [[ ! $tool =~ $jar ]]; then
		which $tool > /dev/null
		case $? in 
			0 )
			echo "  + Found $tool" ;;
			1 )
			echo "  - Not Found $tool, or tool is not executable" ;;
			2 )
			echo "  - Invalid option for $tool" ;;
		esac
	else
		if [[ -e $tool ]]; then
			echo "  + Found $tool"
		else
			echo "  - Not Found $tool"
		fi
	fi
		
}


echo ":::Testing for core components:::"
test bash
test notify-send
test xargs
test nmap
test sqlite3
test flock
test net
test arp-scan
test screen
test "$pythonInterpreter"
echo ":::Testing for plugin tools:::"
test "$m_nikto"
test "$m_amap"
test "$m_rpcinfo"
test "$m_sipsak"
test "$m_ncrack"
test "$m_dirbuster"
test "$m_smap"
test "$m_svwar"
test "$m_onesixtyone"
test "$m_wkhtmltoimage"i*
test "$m_wkhtmltoimage"a*
test "$m_sslscan"
test "$m_smtp_user_enum"
test "$m_ike_scan"
test "$m_ike_scan_sh"
test "$m_skipfish"
test "$m_lbb"
echo ":::Finished:::"
